﻿
// 2013年7月21日4:04:23
// 漠然
// 向UI传递消息的通用静态类

using System;
using System.Diagnostics;

namespace Mrsoft.Common {
    /// <summary>
    /// 统一UI通信类
    /// </summary>
    public static class MsgListener {

        public delegate void CommonMsg(string message);
        public delegate void MsgBoxMsg(string message, string caption);
        public static event CommonMsg CommonMsgEvent;
        public static event MsgBoxMsg MsgBoxMsgEvent;

        public static void CommonMsgShow(string sender, string message) {
            message = string.Format("[{0}]:{1}", sender, message);
            if (CommonMsgEvent != null)
                CommonMsgEvent(message);
        }

        public static void MsgBoxMsgShow(string message, string caption) {
            if (MsgBoxMsgEvent != null)
                MsgBoxMsgEvent(message, caption);
        }
    }
}
